package com.m3958.firstgwt.server.service;

import redis.clients.jedis.Jedis;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class IframeResultStoreService {
	
	@Inject
	private JedisPoolService jedisPool;
	
	public void addIframeResult(String tid,String srjso){
		Jedis jedis = jedisPool.getInstance();
		try {
		  jedis.setex(tid, 300,srjso);
		} finally {
			jedisPool.putBack(jedis);
		}
	}
	
	public String getIframeResult(String tid){
		Jedis jedis = jedisPool.getInstance();
		try {
		  return jedis.get(tid);
		}catch (Exception e) {
			return null;
		} finally {
			jedisPool.putBack(jedis);
		}
	}
}
